package com.example.module_inspection

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.example.module_inspection.databinding.ActivityInspectionBinding
import com.yuwei.base.BaseActivity
import com.yuwei.common.path.RouterPath
import dagger.hilt.android.AndroidEntryPoint
import retrofit2.http.Path
@AndroidEntryPoint
@Route(path = RouterPath.INSPECTION_ORDERS)
class InspectionActivity : BaseActivity<ActivityInspectionBinding,InspectionViewModel>() {
    val inspectionAdapter = InspectionAdapter()
    override fun initView() {
        val linearLayoutManager = LinearLayoutManager(this)
        binding.inspectionRv.adapter = inspectionAdapter
        binding.inspectionRv.layoutManager = linearLayoutManager
        vm.getInspection()
        vm.getPatrol()
        binding.visitorBack.setOnClickListener {
            finish()
        }

    }

    override fun initData() {
        vm.getInspectionSuccess.observe(this){
            inspectionAdapter.data.addAll(it)
            inspectionAdapter.notifyDataSetChanged()
        }
        vm.patrolSuccess.observe(this){
            inspectionAdapter.setList(it)
            inspectionAdapter.notifyDataSetChanged()
        }

    }

}